home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Applications / Portable Patmos 1.1 / README.ORIGINAL < prev    next >
Encoding:
Text File  |  1994-12-09  |  8.0 KB  |  155 lines  |  [TEXT/R*ch]

  1. Patmos README
  2.  
  3.     Patmos “Protected address translation mode operating system” is an application that brings the advantages of protected mode programs to your Quadra class macintosh. By the simple expedient of taking over the memory management unit of the 68040 in a very simple kernel (<100K in size), we immediately gain compatibility with the BSD unix program environment. The advantages of this are as follows:
  4.  
  5. (a)    You can run certain programs (such as /bin/sh) designed for MacBSD
  6. (b)    You can compile almost all GNU software including C and C++ without modifying the source code in any way
  7. (c)    All programs run with a flat 32-meg address space, with no worries about 32K segments or the other mac paraphernalia
  8. (d)    The majority of program bugs can be caught cleanly without crashing your mac
  9. (e)    All your files are shared between Patmos and MacOS so you can edit using your favourite mac editor, then immediately compile in Patmos without having to reboot or copy files around.
  10.  
  11. The downside is that not all macs use the memory management unit in the same way, or even have the same kind of MMU, so Patmos may not run on your particular mac model. However, since the kernel source code is very small, the task of adapting it to a new environment is very simple, and once achieved, all application programs running in user mode are enabled to run without even recompiling.
  12.  
  13. Currently supported kernel functions:
  14.  
  15. Protected mode addressing
  16. 32Meg virtual address space
  17. Berkley a.out executable model (argc, argv, envp) etc.
  18. linear program growth (sbrk,mmap etc.)
  19. dynamic process sizing (no need to calculate size requirements in advance)
  20. HFS (hierarchical filing system) interfaced to BSD syscalls (open, read, write etc.)
  21.  
  22. Partially supported but still buggy:
  23.  
  24. dynamic stack resizing (true alloca etc.)
  25. pipes
  26.  
  27. Not supported (yet)
  28.  
  29. maths co-processor support
  30. pre-emptive multitasking
  31. signals
  32. termcap (non glass TTY)
  33.  
  34. Currently ported software
  35.  
  36. C, C++ (gcc-2.5.8)
  37. as (gas-1.38)
  38. ld,ar etc. (binutils-1.7)
  39. make (gmake-3.70)
  40. gzip (gzip-1.2.4)
  41. sed (sed-2.05)
  42. grep (grep-2.0)
  43. ls,mv,rm etc. (fileutils-3.1)
  44. sort,head,tail etc. (textutils-1.3)
  45. test,env,basename (shellutils-1.5)
  46.  
  47. Installation
  48.  
  49. If you have the latest version of Patmos it will be organised
  50. into 3 self-extracting modules:
  51.  
  52. /bin.sea
  53. /usr.sea
  54. /src/Patmos.sea
  55.  
  56. You can obtain this software by anonymous ftp
  57.  
  58. from nic.switch.ch in the /software/mac/src/Patmos subdirectory
  59.  
  60. The absolute minimum you need to do anything is the kernel (the Patmos application) and shell (sh). This will allow you to determine whether Patmos can run on your machine. These files are present in the /bin.sea archive, together with most of
  61. the small programs that you can typically run from a UNIX shell
  62. The /usr.sea archive contains everything needed to compile and run a C program
  63. that uses the stdio library. This includes everything mentioned above including
  64. the compiler itself.
  65. The /src/Patmos.sea archive contains what is needed to re-compile or debug
  66. the Patmos kernel. You will also need THINK C 5.04 or later. For your convenience
  67. the library include files are already converted to THINK format to drop right into
  68. your THINK-C folder. You will need to turn off the normal THINK-C standard libraries
  69. and headers because they are incompatible with BSD UNIX on the whole. This can be
  70. done by putting brackets () around the (C libraries) folder in the THINK folder. This procedure is documented in the THINK manuals. 
  71.  
  72. Create a top level folder, called 'root' for example on your hard disk. Extract the
  73. archive(s) into this folder. Copy sh from the bin folder into the root.
  74. It is desirable but not essential to create /tmp and /var/tmp directories to hold temporary files for the compiler.
  75.  
  76. You should end up with a structure much like this.
  77.  
  78. HD80:
  79.   root:
  80.     Patmos
  81.     sh
  82.     COPYING
  83.     bin
  84.     usr
  85.     src
  86.     tmp
  87.  
  88. The root directory '/' for Patmos will be the folder containing the first file
  89. opened. After startup. This is conveniently done by dragging and dropping the
  90. 'sh' in the 'root' folder onto the 'Patmos' Application.
  91. You can use other directory structures if you wish but this is untested.
  92. If you have an older version of Patmos the structure and archive names
  93. may be slightly different but things should still work the same.
  94.  
  95. You do not need to set the memory size requirements of Patmos programs
  96. but you do need to set the total partition. This should be as large as possible
  97. leaving room for the system, your favourite editor, and the finder.
  98. 3000K should be adequate to compile a noddy program
  99. 6000K would be typical if you are using make and/or build scripts
  100. 9000K should be sufficient if you want to rebuild the compiler or your latest
  101. multi-megabyte epic project.
  102.  
  103. Getting started.
  104.  
  105. Turn off virtual memory, RAM doubler, Appletalk before attempting to run
  106. Patmos. Other obscure system extensions could interfere as well. 
  107. Make sure you boot in 32-bit mode. I hope to have a version
  108. compatible with Appletalk soon, but Patmos takes over the MMU so it is 
  109. fundamentally incompatible with Apple virtual memory and RAM doubler.
  110. You can still use Autodoubler etc. if you have it to reduce the size of your
  111. executables. Since all filing system calls are via the toolbox, the operation
  112. of this type of program is transparent to Patmos.
  113.  
  114. At startup, the Patmos application will perform some basic checks to see if the machine seems suitable before continuing. It will also consult a database of tested machines to warn you if your machine has ever been tested before. You can add to this database in the application by editing STR# resource 128. Just add the name of your machine as it appears in the “About this macintosh” box. Once you are happy Patmos is working, you can startup by simply dropping the sh program on the Patmos application. Note that the location of the sh program becomes the root of the filing system for that session, so you will need two copies of sh, one in your root folder, and one in your /bin folder.
  115.  
  116. To compile and run a program you will need 
  117.  
  118. /usr/lib/crt0.o 
  119. /usr/lib/libgcc.a 
  120. /usr/lib/libc.a
  121. /usr/bin/{gcc,cpp,cc1,as,ld}
  122.  
  123. You can prepare your source code with an editor such as the freeware BBEdit-2.2.2, be sure to choose the ‘UNIX line endings’ option when you save the source file. A typical compilation command would be
  124.  
  125. gcc plugh.c    where plugh.c is your program
  126.  
  127. this will generate an executable in the current directory, called a.out by default
  128. Run this program by typing
  129.  
  130. a.out
  131.  
  132. The program’s output will appear in the console window, or else a diagnostic message giving an error, and the CPU registers at the time of the error, and if possible, the offending instruction.
  133.  
  134. If you are unfamiliar with the usage of the GNU software, all the source code and manual pages and documentation should be available from the same site you got Patmos from, as well as many other places. The most convenient way to get new source code to compile and run is on the many CDroms that are available.
  135.  
  136. The majority of recent mac
  137. models use a cut down 68LC040 with no maths co-processor so the kernel
  138. and most programs assume the co-processor is unused. You could alter
  139. the kernel to save the FPU context if you have a full 68040 and this would
  140. then work in conjunction with gcc -m68040. You might need to edit the gcc specs
  141. file.
  142.  
  143. Enjoy!
  144.  
  145. License.
  146.     The Patmos kernel is copyright ©1994 by Jonathan Richard Robert Kimmitt. It also incorporates as well as the author’s work, libraries which are copyright the University of California (Berkley). The dissassembly that you get when a program crashes is copyright Free Software Foundation, as is the majority of the application software including the compiler. You may freely copy this software but you must make the source code available to anybody you distribute this software to, or tell them where they can get it. For full details, see the file COPYING
  147.     If you like this program, send a postcard with your suggestions for improvements, what mac you tried it on, etc. to
  148.  
  149. Jonathan Kimmitt
  150. 4 Moyne Close,
  151. Cambridge,
  152. CB4 2TA
  153. ENGLAND
  154.  
  155.     Or if you are excessively lazy, you can send e-mail with your feedback to jrrk@camcon.co.uk